package com.servlet; /**
 * @author wzm
 * @create 2023-03-01 16:12
 */

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
//可以配置多个路径访问一个servlet
@WebServlet(urlPatterns = {"/hello05","/hello06"})
public class Servlet05 extends HttpServlet {
    //当访问Servlet时 是get请求 就会执行的方法
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("执行Get请求");
    }

    //当访问Servlet时 是post请求 就会执行的方法
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("执行Post请求");
    }
}


/*
* Get:
*  form标签 method="get"
* a标签
* link引入css
* script引入js
* img标签引入图标
* iframe引入html
* 浏览器直接输入地址
*
* post: form标签的method=“post"
*
* */